package com.wyzz.hr.pojo.base;

import java.io.Serializable;
import java.util.Set;
import java.util.TreeSet;

import com.wyzz.hr.pojo.Trcourse;
import com.wyzz.hr.pojo.Trtype;

public abstract class BaseTrtype implements Serializable {

	public BaseTrtype() {
		hashCode = 0x80000000;
		initialize();
	}

	public BaseTrtype(String trtNo) {
		hashCode = 0x80000000;
		setTrtNo(trtNo);
		initialize();
	}

	public BaseTrtype(String trtNo, String trtName) {
		hashCode = 0x80000000;
		setTrtNo(trtNo);
		setTrtName(trtName);
		initialize();
	}

	protected void initialize() {
	}

	public String getTrtNo() {
		return trtNo;
	}

	public void setTrtNo(String trtNo) {
		this.trtNo = trtNo;
		hashCode = 0x80000000;
	}

	public String getTrtDesc() {
		return trtDesc;
	}

	public void setTrtDesc(String trtDesc) {
		this.trtDesc = trtDesc;
	}

	public Integer getTrtSortId() {
		return trtSortId;
	}

	public void setTrtSortId(Integer trtSortId) {
		this.trtSortId = trtSortId;
	}

	public String getTrtName() {
		return trtName;
	}

	public void setTrtName(String trtName) {
		this.trtName = trtName;
	}

	public Set getTrcourses() {
		return trcourses;
	}

	public void setTrcourses(Set trcourses) {
		this.trcourses = trcourses;
	}

	public void addTotrcourses(Trcourse trcourse) {
		if (null == getTrcourses())
			setTrcourses(new TreeSet());
		getTrcourses().add(trcourse);
	}

	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (!(obj instanceof Trtype))
			return false;
		Trtype trtype = (Trtype) obj;
		if (null == getTrtNo() || null == trtype.getTrtNo())
			return false;
		else
			return getTrtNo().equals(trtype.getTrtNo());
	}

	public int hashCode() {
		if (0x80000000 == hashCode) {
			if (null == getTrtNo())
				return super.hashCode();
			String hashStr = (new StringBuilder()).append(getClass().getName())
					.append(":").append(getTrtNo().hashCode()).toString();
			hashCode = hashStr.hashCode();
		}
		return hashCode;
	}

	public String toString() {
		return super.toString();
	}

	public static String REF = "Trtype";
	public static String PROP_TRT_NAME = "trtName";
	public static String PROP_TRT_NO = "trtNo";
	public static String PROP_TRT_SORT_ID = "trtSortId";
	public static String PROP_TRT_DESC = "trtDesc";
	private int hashCode;
	private String trtNo;
	private String trtName;
	private String trtDesc;
	private Integer trtSortId;
	private Set trcourses;

}
